class UpdateCredits < ActiveRecord::Migration
  def self.up
    change_table :edition_credits do |t|
      t.remove :artist_id
      t.remove :edition_id
      t.remove :role
      t.integer :artist_id, :null => false
      t.integer :edition_id, :null => false
      t.string :role, :null => false
    end

    change_table :performance_credits do |t|
      t.remove :artist_id
      t.remove :performance_id
      t.remove :role
      t.integer :artist_id, :null => false
      t.integer :performance_id, :null => false
      t.string :role, :null => false
    end

    add_foreign_key(:edition_credits, :artists, :column => :artist_id)
    add_foreign_key(:edition_credits, :editions, :column => :edition_id)
    add_foreign_key(:performance_credits, :artists, :column => :artist_id)
    add_foreign_key(:performance_credits, :performances, :column => :performance_id)
  end

  def self.down
  end
end
